
import 'package:like_chat/final_values.dart';

class HistoryChatModel {
  final String url;
  final String name;
  final String lastMsg;
  final String lastTime;
  final int unreadNum;
  final String friendId;

  HistoryChatModel({this.url = IMG_URL, this.name, this.lastMsg, this.lastTime,
      this.unreadNum = 0,this.friendId});

  @override
  String toString() {
    return 'HistoryChatModel{url: $url, name: $name, lastMsg: $lastMsg, lastTime: $lastTime, unreadNum: $unreadNum, friendId: $friendId}';
  }
}
void main() {
  List<HistoryChatModel> _list = [
    HistoryChatModel(
        name: "张三",
        unreadNum: 0,
        friendId: "10001"
    ),
    HistoryChatModel(
        name: "里斯",
        unreadNum: 1,
        friendId: "10002"
    ),
  ];
  print(_list);

  var _l1 = _list.where((m) => m.friendId != "10002").toList();
  _l1.insert(0, HistoryChatModel(
    name: "里斯",
    unreadNum: 2,
    friendId: "10002"
  ));
  print(_l1);

}